package ceet.ac.cn.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import ceet.ac.cn.dao.TeacherDao;
import ceet.ac.cn.model.teacher;
import ceet.sadmin.SadminDao;
import ceet.sadmin.SadminUser;

/**
 * Servlet implementation class Sshow
 */
@WebServlet("/Sshow")
public class Sshow extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public Sshow() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		String idStr = request.getParameter("username1");
        if(idStr != null && !idStr.equals("")){
            int id = Integer.valueOf(idStr);
            SadminDao dao = new SadminDao();
            SadminUser sadminuser = dao.selectSadminid(id);
            request.setAttribute("sadminuser", sadminuser);
        }
        request.getRequestDispatcher("check2.jsp").forward(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
